//package com.fast.develop.dm.configuration;
//
//import com.fast.develop.dm.configuration.entity1.UserJpaRepository;
//import com.fast.develop.dm.core.ModuleContextFactory;
//import com.fast.develop.dm.integration.HibernateModuleConfiguration;
//import com.fast.develop.dm.integration.HibernateModuleConfigurationBuilder;
//import com.fast.develop.dm.integration.context.DefaultDomainModuleContextFactory;
//import com.fast.develop.dm.integration.context.DefaultModuleContext;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
//
//import javax.annotation.PostConstruct;
//import javax.sql.DataSource;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * @author 莫寅
// * @createTime 2022-06-08 23:25
// * @desc：
// */
//@RestController
//public class ReloadController {
//
//    @Autowired
//    private DataSource source;
//
//    @Autowired
//    private ModuleContextFactory moduleContextFactory;
//
//
//    @GetMapping("reload")
//    public boolean reload(){
//        long start = System.currentTimeMillis();
//
//        DefaultModuleContext defaultModuleContext = (DefaultModuleContext) moduleContextFactory.getDomainModuleContext();
//        defaultModuleContext.destroy();
//
//
//        Map properties = new HashMap();
//        properties.put("hibernate.show_sql", "true");
//        properties.put("hibernate.hbm2ddl.auto", "update");
//
//        HibernateModuleConfiguration hibernateModuleConfiguration = new HibernateModuleConfigurationBuilder()
//                .dataSource(source)
//                .mappingResources(new String[]{"Book.hbm_2.xml"})
//                .properties(properties)
//                .enableResourcesRest()
//                .build();
//        moduleContextFactory.create("abc", hibernateModuleConfiguration);
//
//        System.out.println(System.currentTimeMillis() - start);
//
//        return true;
//    }
//}
